const tbody = document.querySelector('tbody');
getlist();
function getlist() {
    utils.fetch('./api/shop/list.php').then(resp => {
        if (resp.code === 1) {
            const { list } = resp.body;
            tbody.innerHTML = list.reduce((html, shop, index) => {
                html += `
                 <tr data-id="${shop.id}">
                     <td>${index + 1}</td>
                     <td><span>${shop.name}</span><input type="text"></td>
                     <td><span>${shop.price}</span><input type="text"></td>
                     <td><span>${shop.num}</span><input type="text"></td>
                     <td>
                         <button class="btn btn-xs btn-info btn-edit">编辑</button>
                         <button class="btn btn-xs btn-danger btn-del">删除</button>
                         <button class="btn btn-xs btn-success btn-ok">确定</button>
                         <button class="btn btn-xs btn-warning btn-cancel">取消</button>
                    </td>
                </tr> 
                `
                return html;
            },'')
        }
    })
}


